#ifndef FILEIDMAPPER_H
#define FILEIDMAPPER_H

#include <string>
#include <unistd.h>

class FileIDMapper
{
public:
    static FileIDMapper *instance();
    static std::string databaseDir();
    static bool filterFileName(const std::string &filename);
    static bool filterCommand(const std::string &command);

    uint64_t addFile(const std::string &uuid, uint64_t inode);
    bool deleteFile(const std::string &uuid, uint64_t inode);
    bool changeFileInode(const std::string &uuid, uint64_t id, uint64_t inode);

    uint64_t getFileIDByInode(const std::string &uuid, uint64_t inode, bool allocateNonExisted = false);
    uint64_t getFileInodeByID(const std::string &uuid, uint64_t ID);

    void initDataBase(const std::string &uuid);

private:
    FileIDMapper();
};

#endif // FILEIDMAPPER_H
